import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router'
import {
  DateTimeFormat
} from './utils'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/element-variables.scss'

// iconfont
import '@/assets/iconfont/iconfont.css'

// 引入自定义全局组件
import Cbutton from '@/components/Form/Button'
import Ccascader from '@/components/Form/Cascader'
import Cradios from '@/components/Form/Radio'
import Cselect from '@/components/Form/Select'
import Pagination from '@/components/Pagination'
Vue.use(ElementUI)
Vue.component('Cbutton', Cbutton)
Vue.component('Ccascader', Ccascader)
Vue.component('Cradios', Cradios)
Vue.component('Cselect', Cselect)
Vue.component('Pagination', Pagination)

// 按钮权限显示方法
const hasPermission = (permission) => {
  // let myPermissions = store.state.user.userPermissions
  // return myPermissions.indexOf(permission) > -1
  return true
}

Vue.prototype.hasPerm = hasPermission

Vue.config.productionTip = false

Vue.filter('glbDateFormat', function (val) {
  return DateTimeFormat(val, 'yyyy-MM-dd')
})
Vue.filter('glbTimeFormat', function (val) {
  return DateTimeFormat(val, 'yyyy-MM-dd hh:mm:ss')
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
